package com.bdqn.service;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;

/**
 * @author 崔书健
 * @date 2024/7/15
 */
public class ErrorLogger {

    private static final Logger log = LogManager.getLogger(ErrorLogger.class);

    @AfterThrowing(pointcut = "execution(*UserService.*(..))",throwing = "e")
    public void afterThrowing(JoinPoint jp, RuntimeException e){
        log.error(jp.getSignature().getName() + " 方法发生异常：" + e);
    }
}
